package com.example.canteen.service.impl;

import com.example.canteen.domain.Products;
import com.example.canteen.domain.Suppliers;
import com.example.canteen.domain.User;
import com.example.canteen.mapper.ProductsMapper;
import com.example.canteen.mapper.SuppliersMapper;
import com.example.canteen.service.ProductsService;
import com.example.canteen.service.SuppliersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProductsServiceImpl implements ProductsService {
    @Autowired
    private ProductsMapper productsMapper;


    @Override
    public List<Products> selectAllProducts() {
        return productsMapper.getAll();
    }

    @Override
    public Products selectProductsById(int productID) {
        return productsMapper.selectById(productID);
    }

    public Products selectProductsByName(String productname){
        return productsMapper.selectProductsByName(productname);
    }
    @Override
    public int insertProducts(Products products) {
        return ProductsMapper.insertProducts((Products) products);
    }

    @Override
    public int updateProducts(Products products) {
        return ProductsMapper.updateProducts(products);
    }


    @Override
    public int deleteProductsByID(int id) {
        return ProductsMapper.deleteProductsById(id);
    }
}